<?php
/**
 * Template Name:惠州首页
 * @authors QIN JUN (506261843@qq.com)
 * @date    2015-12-04 17:26:00
 * @version 1.0
 */
?>
<!--头部公共文件-->
<?php get_hz_header() ?>

	<div class="pai_main">
		<div class="pai_top">	
			<!-- 轮播 -->
			<div class="topCurrent">
				<div class="swiper-container">
					<div class="swiper-wrapper">

                        <?php
                        foreach (get_field('Carousel_list') as $key => $value) {
                            $url=$value['url']?$value['url']:get_field('swt_link','options');
                            ?>
                            <div class="swiper-slide">
                                <a href="<?php echo $url;?>">
                                    <img src="<?php echo $value['img'];?>" alt="颜值钜惠月">
                                </a>
                            </div>
                        <?php
                        }
                        ?>

					</div>
					<!--分页器。如果放置在swiper-container外面，需要自定义样式。-->
					<div class="swiper-pagination"></div>
				</div>
				<div class="pai_shadow"></div>
                <!-- Add Arrows -->
                <div class="swiper-button-next top_next"></div>
                <div class="swiper-button-prev top_prev"></div>
			</div>
			<!-- 品牌 -->
			<div class="pai_about">
				<img src="<?php echo get_template_directory_uri();?>/hz_index/images/aih.png" alt="">
			</div>
			<!-- 项目 -->
			<div class="pai_box">
				<ul>

                    <?php
                    foreach (get_field('top_list') as $key => $value) {
                        $url=$value['url']?$value['url']:get_field('swt_link','options');
                        $label=$value['label'];
                        ?>

                        <li>
                            <a href="<?php echo $url;?>">
                                <img src="<?php echo $value['img'];?>" alt="">
                                <h3><?php echo $value['name'];?></h3>
                            </a>
                            <?php if($label!='人气'){}else{?>
                                <div class="pai_box_icon">
                                    <img src="<?php echo get_template_directory_uri();?>/hz_index/images/icon_01.png" alt="">
                                </div>
                            <?php
                            } ?>
                        </li>
                    <?php
                    }
                    ?>

					<li>
						<a href="#">更多></a>	                
					</li>
				</ul>
			</div>
		</div>
		<!-- 热卖 -->
		<div class="pai_hot">
			<div class="pai_hot_top">
				<p class="pai_hot_title">热卖特惠</p>
				<div class="pai_refresh">
					<img src="<?php echo get_template_directory_uri();?>/hz_index/images/pai_refresh.png" alt="">
					<p>换一换</p>
				</div>
			</div>
			<div class="pai_hot_box">
				<ul>

                    <?php
                    $hotSell=get_field('hotSell');
                    ?>

					<li>
						<div class="pai_hot_box_one">
							<img src="<?php echo $hotSell[0]['img'];?>" alt="">
							<div class="pai_hot_font">
								<p class="pai_hot_desc"><?php echo $hotSell[0]['label'];?></p>
								<p class="pai_hot_pro"><?php echo $hotSell[0]['name'];?></p>
								<p class="pai_hot_price"><span><?php echo $hotSell[0]['price'];?></span>元</p>
								<a href="#" class="pai_hot_btn">>马上抢购</a>
							</div>
						</div>
						<div class="pai_hot_box_two">
							<div class="pai_hot_box_flex">
								<img src="<?php echo $hotSell[1]['img'];?>" alt="">
								<div class="pai_hot_font">
									<p class="pai_hot_pro"><?php echo $hotSell[1]['name'];?></p>
									<p class="pai_hot_price"><span><?php echo $hotSell[1]['price'];?></span>元</p>
									<a href="#" class="pai_hot_btn">>马上抢购</a>
								</div>
							</div>
							<div class="pai_hot_box_flex">
								<img src="<?php echo $hotSell[2]['img'];?>" alt="">
								<div class="pai_hot_font">
									<p class="pai_hot_pro"><?php echo $hotSell[2]['name'];?></p>
									<p class="pai_hot_price"><span><?php echo $hotSell[2]['price'];?></span>元</p>
									<a href="#" class="pai_hot_btn">>马上抢购</a>
								</div>
							</div>
						</div>
					</li>
					<li>
                        <div class="pai_hot_box_two">
                            <div class="pai_hot_box_flex">
                                <img src="<?php echo $hotSell[3]['img'];?>" alt="">
                                <div class="pai_hot_font">
                                    <p class="pai_hot_pro"><?php echo $hotSell[3]['name'];?></p>
                                    <p class="pai_hot_price"><span><?php echo $hotSell[3]['price'];?></span>元</p>
                                    <a href="#" class="pai_hot_btn">>马上抢购</a>
                                </div>
                            </div>
                            <div class="pai_hot_box_flex">
                                <img src="<?php echo $hotSell[4]['img'];?>" alt="">
                                <div class="pai_hot_font">
                                    <p class="pai_hot_pro"><?php echo $hotSell[4]['name'];?></p>
                                    <p class="pai_hot_price"><span><?php echo $hotSell[4]['price'];?></span>元</p>
                                    <a href="#" class="pai_hot_btn">>马上抢购</a>
                                </div>
                            </div>
                        </div>
                        <div class="pai_hot_box_one">
                            <img src="<?php echo $hotSell[5]['img'];?>" alt="">
                            <div class="pai_hot_font">
                                <p class="pai_hot_desc"><?php echo $hotSell[5]['label'];?></p>
                                <p class="pai_hot_pro"><?php echo $hotSell[5]['name'];?></p>
                                <p class="pai_hot_price"><span><?php echo $hotSell[5]['price'];?></span>元</p>
                                <a href="#" class="pai_hot_btn">>马上抢购</a>
                            </div>
                        </div>
					</li>

				</ul>
			</div>
		</div>
		<!-- 模特 -->
		<div class="pai_mode">
			<div class="swiper-container">
				<div class="swiper-wrapper">

                    <?php
                    foreach (get_field('middle_list') as $key => $value) {
                        $url=$value['url']?$value['url']:get_field('swt_link','options');
                        $textArr=explode('|',$value['text']);
                        ?>
                        <div class="swiper-slide">
                            <img src="<?php echo $value['img'];?>" alt="">
                            <div class="pai_mode_font">
                                <p class="pai_mode_title"><?php echo $textArr[0];?></p>
                                <p class="pai_mode_desc"><?php echo $textArr[1];?></p>
                                <p class="pai_mode_pro"><?php echo $textArr[2];?><br><span><?php echo $textArr[3];?><br><?php echo $textArr[4];?><br><?php echo $textArr[5];?></span></p>
                                <a href="<?php echo $url;?>" class="pai_mode_btn">点击咨询</a>
                            </div>
                        </div>
                    <?php
                    }
                    ?>

				</div>
				<div class="swiper-pagination"></div>
			</div>
			<div class="swiper-button-next top_next"></div>
			<div class="swiper-button-prev top_prev"></div>
		</div>
		
		<div class="pai_bottom">
			<!-- 品牌 -->
			<div class="pai_brand">
				<p class="pai_brand_title">品牌实力<br>国内专业连锁品牌医院</p>
				<ul class="pai_tab">

                    <?php foreach (get_field('brand_list') as $key => $value) {
                        if($key<=0){?>
                            <li class="pai_cur"><?php echo $value['title'];?></li>
                        <?php
                        }else{?>
                            <li><?php echo $value['title'];?></li>
                        <?php
                        }?>
                    <?php
                    }
                    ?>

				</ul>
				<div class="pai_brand_box">

                    <?php
                    foreach (get_field('brand_list') as $key => $value) {
                        if($key<=0){?>
                            <div class="pai_on"><img src="<?php echo $value['img'];?>" alt=""></div>
                        <?php
                        }else{?>
                            <div><img src="<?php echo $value['img'];?>" alt=""></div>
                        <?php
                        }?>
                    <?php
                    }
                    ?>
				</div>
			</div>
			<!-- 专家 -->
			<div class="pai_doc">
				<div class="pai_doc_title">
					<img src="<?php echo get_template_directory_uri();?>/hz_index/images/team_title.png" alt="">
				</div>
				<div class="swiper-container gallery-top">
				    <div class="swiper-wrapper">


                        <?php
                        $paged_view = $_GET['paged_view']?$_GET['paged_view']:1;//判断是否首次加载页面
                        $args=array(
                            'post_type' => 'doctor',
                            'meta_key' => 'rank',
                            'orderby'  => array('meta_value_num' => 'DESC', 'date' => 'DESC'),
                            'posts_per_page' =>8,
                            'paged' =>$paged_view
                        );
                        $query = new WP_Query($args);
                        $head_listArr=array();
                        while($query->have_posts()):$query->the_post();
                            $head_list=get_field("head_list");
                            array_push($head_listArr,$head_list);
                            ?>
                            <div class="swiper-slide">
                                <img src="<?php echo $head_list[0]['img']?>" alt="" class="pai_big_doc">
                                <div class="pai_doc_font">
                                    <p class="pai_name"><?php the_title();?></p>
                                    <p class="pai_job"><?php the_field('title');?></p>
                                    <p class="pai_line"></p>
                                    <p class="pai_sub"><?php the_field('about');?></p>
                                    <p class="pai_line"></p>
                                    <p class="pai_sub">擅长：
                                        <?php foreach(get_field("goodat") as $key=>$value){
                                            echo $value['content'];
                                        } ?>
                                    </p>
                                </div>
                            </div>
                        <?php
                        endwhile;
                        wp_reset_query();
                        ?>


					</div>
				</div>
				<div class="swiper-button-next top_next team_next"></div>
				<div class="swiper-button-prev top_prev team_prev"></div>
				<div class="pai_smcontrol">
				    <div class="swiper-container gallery-thumbs">
				        <div class="swiper-wrapper">


                            <?php foreach($head_listArr as $key=>$value){?>
                                <div class="swiper-slide">
                                    <img src="<?php echo $value[1]['img']?>" alt="" class="pai_small_doc">
                                </div>
                            <?php
                            } ?>


				        </div>
				    </div>
				</div>
			</div>
			<a href="#" class="pai_doc_btn">咨询</a>
		</div>

	</div>
<!--底部公共文件-->
<?php get_hz_footer(); ?>